package componentes;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 * @author Reynald0
 */
public  class CompAtomo extends JButton
{
   private String simbolo;
   private String nombre;
   private String numeroAtom;
   private String peso;
 
   public CompAtomo(JPanel pPanel,String pSimbolo,String pNombre,String pNumeroAtom,String pPeso,ActionListener pAccion,String pUbicacion,Color pColor)
   {
 
      simbolo= pSimbolo;
      nombre= pNombre;
      numeroAtom= pNumeroAtom;
      peso = pPeso;
      this.setBackground(pColor);
      this.setAlignmentX(CENTER_ALIGNMENT);
      this.setText("<html>"+
                  "<body>"+
                  "<font size=2><center>"+numeroAtom+"</center></font><"+
                  "<font size=2><center>"+ nombre + "</center></font>"+
                  "<font size=4><center>"+ simbolo +"</center>" +
                  "<font size=2><center>"+ peso +"</center></font>" +
                  "</body>"+
                  "</html>");
      this.setAlignmentX(CENTER_ALIGNMENT);
      this.addActionListener(pAccion);
      if(pPanel!=null)pPanel.add(this,pUbicacion);
      
   }
   public String toString()
   {
      return String.format("%s,%s,%s,%s",simbolo,nombre,numeroAtom,peso);
      
   }
   public void imprimir()
   {

   }
   public void dibujar(Graphics g)
   {
      
   }
}

